package cn.bb.bbstudy.service.impl;

import cn.bb.bbstudy.dao.QuestionDAO;
import cn.bb.bbstudy.pojo.Question;
import cn.bb.bbstudy.service.QuestionService;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional
public class QuestionServiceImpl implements QuestionService{

    @Resource
    private QuestionDAO questionDAO;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return questionDAO.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Question record) {
        return questionDAO.insert(record);
    }

    @Override
    public int insertSelective(Question record) {
        return questionDAO.insertSelective(record);
    }

    @Override
    public Question selectByPrimaryKey(Integer id) {
        return questionDAO.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Question record) {
        return questionDAO.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Question record) {
        return questionDAO.updateByPrimaryKey(record);
    }

    public Page<Question> findAllDesc() {
        return questionDAO.findAllDesc();
    }

    public Page<Question> findAllByCIdDesc(Integer cid) {
        return questionDAO.findAllByCIdDesc(cid);
    }

    public Question findOneByQid(String qid) {
        return questionDAO.findOneByQid(qid);
    }

    public int count(String uid) {
        return questionDAO.count(uid);
    }

    public Page<Question> findAllByUidDesc(String uid) {
        return questionDAO.findAllByUidDesc(uid);
    }
}
